﻿namespace Pp.UI.Binders
{
    using System;
    using System.Web.Mvc;

    public abstract class ModelBinder : ModelBinderBase
    {
        public abstract Type Handles { get; }

        protected override object Bind(ControllerContext controllerContext, ModelBindingContext bindingContext)
        {
            SetModelValue(bindingContext, controllerContext);
            return BindDTO(controllerContext, bindingContext);
        }

        protected abstract object BindDTO(ControllerContext controllerContext, ModelBindingContext bindingContext);
    }
}